package com.zat.mes.andrmes.dofun.work.adapter

import android.media.Image
import android.text.TextUtils
import android.widget.ImageView
import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.module.LoadMoreModule
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.zat.mes.andrmes.R
import com.zat.mes.andrmes.data.GetPackBean
import com.zat.mes.andrmes.data.MacCheckBean
import com.zat.mes.andrmes.data.MachineCareDayBean
import com.zat.mes.andrmes.data.MachineCareWeekBean

/**
 * @author zy
 * @date :2020-02-22 09:28
 * @description: 机器周保养
 */
class MacCareWeekAdapter(layoutResId: Int) :
    BaseQuickAdapter<MachineCareWeekBean, BaseViewHolder>(layoutResId), LoadMoreModule {

    override fun convert(helper: BaseViewHolder, item: MachineCareWeekBean) {
        helper.setText(R.id.tvEmpNameMacCkList, "员工：" + item?.empName)
        helper.setText(R.id.tvMacNoCkList, "设备编码：" + item?.machineNo)
        if (item?.removableReed == "1") {
            helper.getView<ImageView>(R.id.ivremovableReedCkList)
                .setImageResource(R.mipmap.ico_selected)
        } else {
            helper.getView<ImageView>(R.id.ivremovableReedCkList)
                .setImageResource(R.mipmap.ico_unselect)
        }
        if (item?.settlerBed == "1") {
            helper.getView<ImageView>(R.id.ivsettlerBedCkList)
                .setImageResource(R.mipmap.ico_selected)
        } else {
            helper.getView<ImageView>(R.id.ivsettlerBedCkList)
                .setImageResource(R.mipmap.ico_unselect)
        }
        if (item?.powerBox == "1") {
            helper.getView<ImageView>(R.id.ivpowerBoxCkList)
                .setImageResource(R.mipmap.ico_selected)
        } else {
            helper.getView<ImageView>(R.id.ivpowerBoxCkList)
                .setImageResource(R.mipmap.ico_unselect)
        }
        if (item?.drawRollerMotor == "1") {
            helper.getView<ImageView>(R.id.ivdrawRollerMotorCkList)
                .setImageResource(R.mipmap.ico_selected)
        } else {
            helper.getView<ImageView>(R.id.ivdrawRollerMotorCkList)
                .setImageResource(R.mipmap.ico_unselect)

        }
        if (item?.organism == "1") {
            helper.getView<ImageView>(R.id.ivorganismCkList)
                .setImageResource(R.mipmap.ico_selected)
        } else {
            helper.getView<ImageView>(R.id.ivorganismCkList)
                .setImageResource(R.mipmap.ico_unselect)

        }

        if (item?.nozzleGuides == "1") {
            helper.getView<ImageView>(R.id.ivnozzleGuidesCkList)
                .setImageResource(R.mipmap.ico_selected)
        } else {
            helper.getView<ImageView>(R.id.ivnozzleGuidesCkList)
                .setImageResource(R.mipmap.ico_unselect)

        }
        if (item?.needleBed == "1") {
            helper.getView<ImageView>(R.id.ivneedleBedCkList)
                .setImageResource(R.mipmap.ico_selected)
        } else {
            helper.getView<ImageView>(R.id.ivneedleBedCkList)
                .setImageResource(R.mipmap.ico_unselect)

        }
        if (item?.backAndSideDoor == "1") {
            helper.getView<ImageView>(R.id.ivbackAndSideDoorCkList)
                .setImageResource(R.mipmap.ico_selected)
        } else {
            helper.getView<ImageView>(R.id.ivbackAndSideDoorCkList)
                .setImageResource(R.mipmap.ico_unselect)

        }
        if (item?.railAndIndentation == "1") {
            helper.getView<ImageView>(R.id.ivrailAndIndentationCkList)
                .setImageResource(R.mipmap.ico_selected)
        } else {
            helper.getView<ImageView>(R.id.ivrailAndIndentationCkList)
                .setImageResource(R.mipmap.ico_unselect)

        }
        if (item?.track == "1") {
            helper.getView<ImageView>(R.id.ivtrackCkList)
                .setImageResource(R.mipmap.ico_selected)
        } else {
            helper.getView<ImageView>(R.id.ivtrackCkList)
                .setImageResource(R.mipmap.ico_unselect)

        }

    }
}